package com.qyi.activemq.queue.consumer;

import cn.hutool.core.date.DateUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.jms.annotation.JmsListener;
import org.springframework.stereotype.Service;

/**
 * @author luqi
 * @Date 2021/3/11 10:09
 * @Description TODO
 */
@Service
@Slf4j
public class MqConsumerService {

    @JmsListener(destination = "q2-delay", containerFactory = "jmsListenerContainerQueue", concurrency = "1")
    public void receiveDelay(String msg) throws Exception {
        log.info("consumer q2-delay:{},now:{}", msg, DateUtil.now());
    }

    @JmsListener(destination = "q2-repeat", containerFactory = "jmsListenerContainerQueue", concurrency = "1")
    public void receiveRepeat(String msg) throws Exception {
        log.info("consumer q2-repeat:{},now:{}", msg, DateUtil.now());
    }

    @JmsListener(destination = "q2-corn", containerFactory = "jmsListenerContainerQueue", concurrency = "1")
    public void receiveCorn(String msg) throws Exception {
        log.info("consumer q2-corn:{},now:{}", msg, DateUtil.now());
    }
}
